<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
	// 数据类型：基本类型（String,Number,Boolean,Null,Undefined,Symbol），引用类型（Object）
	var a = 'aaa';
	var b = 123;
	var c = true;
	var d = null;
	var e = undefined;
	var f = Symbol('aaa');
	// console.log(f);

	var obj1 = {
		name: 'zhangsan',
		age: 10,
		hobby: ['basketball', 'football'],
		dress: {
			upper: 'T shirt',			
			trousers: 'pants',
			shoes: 'nike'
		}
	};

	function copy(obj){
		var obj2 = {};
		for(var v in obj){
			if(typeof obj[v] == 'object'){
				obj2[v] = copy(obj[v]);
			}else{
				obj2[v] = obj[v];
			}
		}
		return obj2;
	}

	var obj2 = copy(obj1);

	obj1.name = 'bb';
	obj1.dress.trousers = '裤子'

	console.log(obj1,obj2);

	</script>
</body>
</html>